package mc.contents.web.common;

import mc.support.crawler.SortType;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 14-12-8.
 */
public class SortMap {
    public static final String COMPREHENSIVE = "default";
    public static final String POPULARITY = "renqi-desc";
    public static final String SALES = "sale-desc";
    public static final String PRICE_ASC = "price-asc";
    public static final String PRICE_DESC = "price-desc";

    public static final String T_COMPREHENSIVE = "s";
    public static final String T_POPULARITY = "rq";
    public static final String T_SALES = "d";
    public static final String T_PRICE_ASC = "p";
    public static final String T_PRICE_DESC = "pd";
    public static final String T_PRODUCT = "new";

    public static final String CREDIT_DESC = "credit-desc";
    public static final String OLD_STARTS = "old_starts";
    public static final String MOBILE_POPULARITY = "";
    public static final String MOBILE_SALES = "_sale";
    public static final String MOBILE_CREDIT = "_ratesum";
    public static final String MOBILE_PRICE_ASC = "bid";
    public static final String MOBILE_PRICE_DESC = "_bid";

    public static final Map<SortType, String> sortTypeName = new HashMap<SortType, String>() {
        {
            put( SortType.comprehensive, COMPREHENSIVE );
            put( SortType.popularity, POPULARITY );
            put( SortType.sales, SALES );
            put( SortType.priceAsc, PRICE_ASC );
            put( SortType.priceDesc, PRICE_DESC );

            put( SortType.tcomprehensive, T_COMPREHENSIVE );
            put( SortType.tpopularity, T_POPULARITY );
            put( SortType.tNewProduct, T_PRODUCT );
            put( SortType.tsales, T_SALES );
            put( SortType.tpriceAsc, T_PRICE_ASC );
            put( SortType.tpriceDesc, T_PRICE_DESC );

            put( SortType.creditDesc,CREDIT_DESC);
            put( SortType.oldStarts,OLD_STARTS);
            put( SortType.mobileCredit,MOBILE_CREDIT);
            put( SortType.mobilePopularity,MOBILE_POPULARITY);
            put( SortType.mobilePriceAsc,MOBILE_PRICE_ASC);
            put( SortType.mobilePriceDesc,MOBILE_PRICE_DESC);
            put( SortType.mobileSales,MOBILE_SALES);

            put( SortType.mallComprehensive, T_COMPREHENSIVE );
            put( SortType.mallPopularity, T_POPULARITY );
            put( SortType.mallSales, T_SALES );
            put( SortType.mallPriceAsc, T_PRICE_ASC );
            put( SortType.mallPriceDesc, T_PRICE_DESC );
        }
    };
    public static String getSortType( String sortType ){
        return sortTypeName.get( SortType.valueOf( sortType ) );
    }
}
